package com.hspedu.interface_;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/1/27
 * @time 19:58
 */
public class Interface01 {
    public static void main(String[] args) {
        LittleMonkey wukong = new LittleMonkey("wukong");
        wukong.fly();
        wukong.climb();
        wukong.swim();
    }
}

class Monkey{
    private String name;

    public Monkey(String name) {
        this.name = name;
    }

    public void climb(){
        System.out.println(name + "爬山");
    }

    public String getName() {
        return name;
    }
}

class LittleMonkey extends Monkey implements Fishable,Bird{
    public LittleMonkey(String name) {
        super(name);
    }

    @Override
    public void swim() {
        System.out.println(getName() + "会游泳了");
    }

    @Override
    public void fly() {
        System.out.println(getName() + "会飞翔了");
    }
}

interface Fishable{
    void swim();
}

interface Bird{
    void fly();
}